package com.my.chapter10;

public class practice15 {
    public static void main(String[] args) {
        Outer15 o = new Outer15();
        P15 p = o.get(6);
        p.display();
    }
}

class P15{
    private int value;

    public P15(int x){
        value = x;
        System.out.println("P15 constructor "+x);
    }

    public void display(){
        System.out.println("value= "+value);
    }

    public int getValue(){
        return value;
    }
}

class Outer15{
    P15 get(int x){
        return new P15(x){
            public void display(){
                System.out.println("Outer15.P15.value= "+getValue());
            }
        };
    }
}
